


//设备查询
export function sniff() {
    var u = navigator.userAgent.toLocaleLowerCase();
    var ios = u.indexOf("iphone") > 0 || u.indexOf("iPad") > 0;
    var android = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1;//android终端
    var weixin = u.match(/MicroMessenger/i) == "micromessenger"//微信
    return {
        ios: ios,
        android: android,
        weixin:weixin
    }
}
//jsbridge基础
export function setupWebViewJavascriptBridge(callback) {
    if(window.WebViewJavascriptBridge) {
		return callback(WebViewJavascriptBridge);
	}
	if(window.WVJBCallbacks) {
		return window.WVJBCallbacks.push(callback);
	}
	window.WVJBCallbacks = [callback];
	var WVJBIframe = document.createElement('iframe');
	WVJBIframe.style.display = 'none';
	WVJBIframe.src = 'wvjbscheme://__BRIDGE_LOADED__';
	document.documentElement.appendChild(WVJBIframe);
	setTimeout(function() {
		document.documentElement.removeChild(WVJBIframe)
	}, 0)
}
//
